                       
<div class="container">
  <div class="row">
    <div id="allmap" style="height:600px;"> 
    </div>
  </div>
</div>

<div class="container">
  <div class="row">
    <div class="col-md-5 panel panel-primary">
      <div class="panel-heading">
        <h3 class="panel-title">通知公告<span class="pull-right">更多</span></h3>
      </div>
     <div class="panel-body">
        <section>
                {notempty name='article_list'}
                    {volist name='article_list' id='vo'}
                            <div>
                                <div class="lead">
                                    <h4><a href="{:url('index/a_details',array('id' => $vo['id']))}">{$vo.name|html_entity_decode}{$vo.describe}</a>
                                      <p style="float: right;">{$vo.create_time} </p></h4>
                                </div>                               
                                <hr/>
                            </div>
                      {/volist}
                  {else/}
                    <div>{:config('empty_list_describe')}</div>
                {/notempty}
                
                
            </section>
          <!--   {$article_list->render()} -->

      </div>

    </ul>
   <!--  <div class="panel-footer">面板脚注</div> -->
  </div>
  <div class="col-md-7 panel panel-primary">
    <div class="panel-heading">
      <h3 class="panel-title">小屋动态<span class="pull-right">更多</span></h3>
    </div>

    <div class="panel-body">
       <section>
                {notempty name='activityDetail_list'}
                    {volist name='activityDetail_list' id='vo'}
                            <div>
                                <div class="lead">
                                    <h4><a href="{:url('index/details',array('id' => $vo['id']))}">{$vo.healthroom}举行关于{$vo.lecture_type}的活动</a>
                                      <p style="float:right">{$vo.create_time} </p>
                                    </h4>
                                </div>
                                <hr/>
                            </div>
                      {/volist}
                  {else/}
                    <div>{:config('empty_list_describe')}</div>
                {/notempty}
                
                
            </section>
    </div>
    <ul class="list-group">

    </ul>
  <!--   <div class="panel-footer">面板脚注</div> -->
  </div>

</div>
</div>

<div id="container">
  <div id="content" class="full-width"></div>

  <section class="slogan">
    <h2>邯郸市健康小屋</h2>
    <h3>下沉优质医疗资源，医师要当防病的主力军，好医生必须下基层，名医要到民间</h3>
  </section>

  <ul class="services">                                        
    <li class="service">
      <figure class="service-thumb"><a href="#"><img src="__STATIC__\index\images\Refined\small\serv1.png" alt="Diagnostic Imaging"></a></figure>
      <h4><a href="#">政府主导</a></h4>
      <p>充分发挥各县（市、区）政府在推进“健康邯郸”建设、保障全民健康中的主导作用，市卫生计生委统筹规划，人力资源社会保障、财政等部门全力保障，各乡镇党委（街道党工委）、各村村“两委”（大学生村官）负责管理，推动“健康小屋”建设。</p>
    </li>
    <li class="service">
      <figure class="service-thumb"><a href="#"><img src="__STATIC__\index\images\Refined\small\serv2.png" alt="Cancer Care"></a></figure>
      <h4><a href="#">医院主建</a></h4>
      <p>由二级以上医疗机构与社区卫生服务中心（站）、乡镇卫生院、村卫生室等基层医疗机构双向选择、上下结合、协商建设。基层医疗机构提供场地，并与建设医疗机构建立双向转诊绿色通道。</p>
    </li>
    <li class="service">
      <figure class="service-thumb"><a href="#"><img src="__STATIC__\index\images\Refined\small\serv3.png" alt="Rehabilitation Center"></a></figure>
      <h4><a href="#">医生主动</a></h4>
      <p>“健康小屋”命名专家（屋主）要求是邯郸市二级以上医疗机构副高及以上职称或高年资知名专家，以在职专家为主，退居二线专家为辅，做到专家下沉、关口前移。专家（屋主）及其团队在“健康小屋”工作每月不少于4个工作日，具体活动时间由屋主与基层医疗机构商定。</p>
    </li>
    <li class="service">
      <figure class="service-thumb"><a href="#"><img src="__STATIC__\index\images\Refined\small\serv4.png" alt="Emergency Services"></a></figure>
      <h4><a href="#">全民参与</a></h4>
      <p>以基层医疗机构为平台，居委会（村委会）健康家庭小组长组织辖区居民参与到“健康小屋”活动中，开展针对慢性病患者、老年人、儿童、孕产妇等重点人群的健康教育、健康管理和疾病干预指导。</p>
    </li>
                              <!-- <li class="service">
                                  <figure class="service-thumb"><a href="single-service.html"><img src="__STATIC__\index\images\Refined\small\serv5.png" alt="Transplant Services"></a></figure>
                                  <h4><a href="single-service.html">Transplant Services</a></h4>
                                  <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
                                </li>               -->                                 
                              </ul><!-- end of services -->       

                            </div> <!-- end of official -->

                            <!-- twitter update list -->
                      <!-- <ul id="twitter_update_list">
                        <li>No Tweet Loaded !</li>
                    </ul>

                    <script src="__STATIC__\index\js\twitter.min.js" type="text/javascript"></script>
                    <script type="text/javascript">
                        getTwitters('twitter_update_list', { 
                          id: '960development', 
                          count: 1,
                          enableLinks: true, 
                          ignoreReplies: true, 
                          clearContents: true,
                          template: '%text%'
                      });
                    </script>            -->                  


                  </div><!-- end of container -->
                  <script type="text/javascript">
    // 百度地图API功能
    var map = new BMap.Map("allmap");
    // map.centerAndZoom(new BMap.Point(114.518051,36.582546),15);
    map.enableScrollWheelZoom();

  //map.disableDragging();//禁止拖动
//map.disableDoubleClickZoom();//禁止双击缩放
var blist = [];
var districtLoading = 0;

function getBoundary() {   
 addDistrict("邯郸市");
   //addDistrict("天津市");


                //标注
                var point = new BMap.Point(114.518051,36.582546);
                var mk = new BMap.Marker(point);
                map.addOverlay(mk);

              }

/**
 * 添加行政区划
 * @param {} districtName 行政区划名
 * @returns  无返回值
 */
 function addDistrict(districtName) {
    //使用计数器来控制加载过程
    districtLoading++;
    var bdary = new BMap.Boundary();
    bdary.get(districtName, function (rs) {       //获取行政区域
        var count = rs.boundaries.length; //行政区域的点有多少个
        if (count === 0) {
          alert('未能获取当前输入行政区域');
          return;
        }
        for (var i = 0; i < count; i++) {
          blist.push({ points: rs.boundaries[i], name: districtName });
        };
        //加载完成区域点后计数器-1
        districtLoading--;
        if (districtLoading == 0) {
            //全加载完成后画端点
            drawBoundary();
          }
        });
  }
  function drawBoundary() {
    //包含所有区域的点数组
    var pointArray = [];

    /*画遮蔽层的相关方法
    *思路: 首先在中国地图最外画一圈，圈住理论上所有的中国领土，然后再将每个闭合区域合并进来，并全部连到西北角。
    *      这样就做出了一个经过多次西北角的闭合多边形*/
    //定义中国东南西北端点，作为第一层
    var pNW = { lat: 59.0, lng: 73.0 }
    var pNE = { lat: 59.0, lng: 136.0 }
    var pSE = { lat: 3.0, lng: 136.0 }
    var pSW = { lat: 3.0, lng: 73.0 }
    //向数组中添加一次闭合多边形，并将西北角再加一次作为之后画闭合区域的起点
    var pArray = [];
    pArray.push(pNW);
    pArray.push(pSW);
    pArray.push(pSE);
    pArray.push(pNE);
    pArray.push(pNW);
    //循环添加各闭合区域
    for (var i = 0; i < blist.length; i++) {
        //添加显示用标签层
        var label = new BMap.Label(blist[i].name, { offset: new BMap.Size(20, -10) });
        label.hide();
        map.addOverlay(label);

        //添加多边形层并显示
        var ply = new BMap.Polygon(blist[i].points, { strokeWeight: 5, strokeColor: "#FF00FF", fillOpacity: 0.01, fillColor: " #FFFFFF" }); //建立多边形覆盖物
        ply.name = blist[i].name;
        ply.label = label;

        ply.addEventListener("click", click);
        ply.addEventListener("mouseover", mouseover);
        ply.addEventListener("mouseout", mouseout);
        ply.addEventListener("mousemove", mousemove);

        map.addOverlay(ply);

        //添加名称标签层
        // var centerlabel = new BMap.Label(blist[i].name, { offset: new BMap.Size(0, 0) });
        // centerlabel.setPosition(ply.getBounds().getCenter());
        // map.addOverlay(centerlabel);

        //将点增加到视野范围内
        var path = ply.getPath();
        pointArray = pointArray.concat(path);
        //将闭合区域加到遮蔽层上，每次添加完后要再加一次西北角作为下次添加的起点和最后一次的终点
        pArray = pArray.concat(path);
        pArray.push(pArray[0]);
      }

    //限定显示区域，需要引用api库
    var boundply = new BMap.Polygon(pointArray);
    BMapLib.AreaRestriction.setBounds(map, boundply.getBounds());

    map.setViewport(pointArray);    //调整视野 

    //添加遮蔽层
    var plyall = new BMap.Polygon(pArray, { strokeOpacity: 0.0000001, strokeColor: "#000000", strokeWeight: 5, fillColor: "#000000", fillOpacity: 0.4 }); //建立多边形覆盖物
    map.addOverlay(plyall);
    //自定义
    map.centerAndZoom(new BMap.Point(114.518051,36.582546),10);
  }
  setTimeout(function(){
    getBoundary();
  }, 500);
/**
 * 各种鼠标事件绑定
 */
 function click(evt) {
  alert(evt.target.name);
}

function mouseover(evt) {
  evt.target.label.setZIndex(99);
  evt.target.label.setPosition(evt.point);
  evt.target.label.show();
}

function mousemove(evt) {
  evt.target.label.setPosition(evt.point);
}

function mouseout(evt) {
  evt.target.label.hide();
}
var data_info = [
           [114.516374,36.624217,"<a href={:url('index/healthroomList', ['room_id'=>'1304034010'])} ><h3>信栓力健康小屋</h3></a>"+"<p>丛东街道卫生服务中心<p>"],
           [114.500386,36.587308,"<a href={:url('index/healthroomList', ['room_id'=>'1304024010'])} ><h3>马晓云健康小屋</h3></a>"+"<p>罗城头街道社区卫生服务中心</p>"],
           [114.524058,36.611731,"<a href={:url('index/healthroomList', ['room_id'=>'1304034008'])} ><h3>靳文军健康小屋</h3></a>"+"<p>柳林桥街道社区卫生服务中心</p>"],
           [114.504569,36.586262,"<a href={:url('index/healthroomList', ['room_id'=>'1304024008'])} ><h3>胡新磊健康小屋</h3></a>"+"<p>邯山区医院</p>"],
           [114.489285,36.621623,"<a href={:url('index/healthroomList', ['room_id'=>'1304034009'])} ><h3>王德峰健康小屋</h3></a>"+"<p>四季青街道卫生服务中心</p>"],
           [114.550973,36.62509,"<a href={:url('index/healthroomList', ['room_id'=>'1304214008'])} ><h3>申秀梅健康小屋</h3></a>"+"<p>新科园社区卫生服务中心</p>"],
           [114.397398,36.383425,"<a href={:url('index/healthroomList', ['room_id'=>'1304274005'])} ><h3>任芬花健康小屋</h3></a>"+"<p>磁县磁州中心卫生站</p>"],
           [114.487473,36.598249,"<a href={:url('index/healthroomList', ['room_id'=>'1304024012'])} ><h3>马喆健康小屋</h3></a>"+"<p>邯山区贸西社区卫生服务中心</p>"],
           [115.014572,36.526335,"<a href={:url('index/healthroomList', ['room_id'=>'1304324003'])} ><h3>刘吉祥健康小屋</h3></a>"+"<p>南阳堡镇刘贵芳爱心敬老院</p>"],
          ];
  var opts = {
        width : 250,     // 信息窗口宽度
        height: 100,     // 信息窗口高度
        title : "信息窗口" , // 信息窗口标题
        // enableMessage:true//设置允许信息窗发送短息
         };
  for(var i=0;i<data_info.length;i++){
    var marker = new BMap.Marker(new BMap.Point(data_info[i][0],data_info[i][1]));  // 创建标注
    var content = data_info[i][2];
    map.addOverlay(marker);               // 将标注添加到地图中
    addClickHandler(content,marker);
  }

  function addClickHandler(content,marker){
    marker.addEventListener("click",function(e){
      openInfo(content,e)}
    );
  }

  function openInfo(content,e){
    var p = e.target;
    var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat);
    var infoWindow = new BMap.InfoWindow(content,opts);  // 创建信息窗口对象 
    map.openInfoWindow(infoWindow,point); //开启信息窗口
  }
</script>




